package com.feng.zhihao.apigeteway.gateway.bean.impl.FIELD_TYPE;

import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;
import com.feng.zhihao.apigeteway.entity.InterfaceFieldInfo;
import com.feng.zhihao.apigeteway.gateway.bean.FIELD_TYPE;
import com.xiaoleilu.hutool.util.StrUtil;

@Component("FIELD_TYPE_OBJECT")
public class FIELD_TYPE_OBJECT implements FIELD_TYPE {

	@Override
	public String validatorField(InterfaceFieldInfo fieldInfo, Object value) {
		return value instanceof JSONObject ? "" : 
			StrUtil.format("字段:({}), 不是对象:({});\r\n",fieldInfo.getInterfaceFieldName(),value.toString());
	}

}
